home *** CD-ROM | disk | FTP | other *** search
/ Geek Games #12 / GEGA012.iso / Jogos de Azar / 1721-apuesten.swf / scripts / C_DealButtonCLASS.as < prev    next >
Text File  |  2006-01-17  |  3KB  |  130 lines

  1. _global.C_DealButtonCLASS = function()
  2. {
  3.    AsBroadcaster.initialize(this);
  4.    this.init();
  5. };
  6. C_DealButtonCLASS.prototype = new MovieClip();
  7. C_DealButtonCLASS.prototype.init = function()
  8. {
  9.    this.keys = [13];
  10.    this.onKeyDown = function()
  11.    {
  12.       var a = this.keys;
  13.       var k = Key.getCode();
  14.       var i = 0;
  15.       while(i < a.length)
  16.       {
  17.          if(k == a[i])
  18.          {
  19.             this.onButtonPress();
  20.          }
  21.          i++;
  22.       }
  23.    };
  24.    var b = this.dealButton_btn;
  25.    b.onRelease = function()
  26.    {
  27.       this._parent.onButtonPress();
  28.    };
  29.    b.onRollOver = b.onDragOver = function()
  30.    {
  31.       this._parent.onButtonFocus();
  32.    };
  33.    b.onDragOut = b.releaseOutside = b.onRollOut = function()
  34.    {
  35.       this._parent.onButtonBlur();
  36.    };
  37.    if(b)
  38.    {
  39.       Key.addListener(this);
  40.    }
  41.    if(this.label != undefined)
  42.    {
  43.       this.setLabel(this.label);
  44.    }
  45. };
  46. C_DealButtonCLASS.prototype.lock = function()
  47. {
  48.    if(this.locked)
  49.    {
  50.       return undefined;
  51.    }
  52.    this.locked = true;
  53.    this.onRelease = function()
  54.    {
  55.    };
  56.    this.useHandCursor = false;
  57.    this.dealButton_btn._brightness = -40;
  58.    this.label_mc._brightness = -40;
  59.    this.onButtonBlur();
  60. };
  61. C_DealButtonCLASS.prototype.unlock = function()
  62. {
  63.    if(!this.locked)
  64.    {
  65.       return undefined;
  66.    }
  67.    this.locked = false;
  68.    delete this.onRelease;
  69.    delete this.useHandCursor;
  70.    this.dealButton_btn._brightness = 0;
  71.    this.label_mc._brightness = 0;
  72. };
  73. C_DealButtonCLASS.prototype.onButtonPress = function()
  74. {
  75.    if(this.locked)
  76.    {
  77.       return undefined;
  78.    }
  79.    if(this.hint != undefined)
  80.    {
  81.       this.hideAlt();
  82.    }
  83.    var c = this.client;
  84.    c.client[c.handler]();
  85.    this.client.client._caller = this;
  86.    this.broadcastMessage("onPress");
  87. };
  88. C_DealButtonCLASS.prototype.onButtonFocus = function()
  89. {
  90.    if(this.locked)
  91.    {
  92.       return undefined;
  93.    }
  94.    if(this.hint != undefined)
  95.    {
  96.       this.showAlt(this.hint);
  97.    }
  98.    this.client.client._caller = this;
  99.    this.broadcastMessage("onFocus");
  100. };
  101. C_DealButtonCLASS.prototype.onButtonBlur = function()
  102. {
  103.    if(this.hint != undefined)
  104.    {
  105.       this.hideAlt();
  106.    }
  107.    this.client.client._caller = this;
  108.    this.broadcastMessage("onBlur");
  109. };
  110. C_DealButtonCLASS.prototype.setChangeHandler = function(handler, client)
  111. {
  112.    this.client = {handler:handler,client:client};
  113. };
  114. C_DealButtonCLASS.prototype.setKeys = function()
  115. {
  116.    this.keys = [];
  117.    var i = 0;
  118.    while(i < arguments.length)
  119.    {
  120.       this.keys.push(arguments[i]);
  121.       i++;
  122.    }
  123. };
  124. C_DealButtonCLASS.prototype.setLabel = function(label)
  125. {
  126.    this.label_mc.gotoAndStop(label);
  127. };
  128. ASSetPropFlags(_global,"C_DealButtonCLASS",131);
  129. Object.registerClass("C_DealButtonCLASS",C_DealButtonCLASS);
  130.